﻿@model JCTimes.DomainModel.Entity.PDA
@{
    ViewBag.Title = "PDA修改";
    var roleid = SessionHelper.CurrUser.RoleID;
}

@Styles.Render("~/Content/forms")
@using (Ajax.BeginForm(new AjaxOptions { OnSuccess = "GetMsg" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        @Html.HiddenFor(u => Model.ID)
       <div class="editor-label">
            @Html.LabelFor(model => model.PDANo)
        </div>
        <div class="editor-field">
            @Html.DisplayFor(model => model.PDANo)
        </div>
       @if (roleid == Constant.Admin)
       {
        <div class="editor-label">
            @Html.LabelFor(model => model.CreateUsersID)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.CreateUsersID, new DropDownList(DropDownListType.Agency), "--请选择--")
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.UsersID)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.UsersID, new DropDownList(DropDownListType.Account), "--请选择--")
        </div>
       }
       else if(roleid==Constant.Agency)
       {
           <div class="editor-label">
            @Html.LabelFor(model => model.UsersID)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.UsersID, new DropDownList(DropDownListType.Account), "--请选择--")
        </div>
       }
         
       <div class="editor-label">
            @Html.LabelFor(model => model.Purpose)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Purpose)
            @Html.ValidationMessageFor(model => model.Purpose)
        </div>
        <p style="text-align: center">
            <input class="button" type="submit" value="提交" />
            <input class="button" type="button" value="返回" onclick="location.href='@Url.Action("Index")'" />
        </p>
    </fieldset>
}
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
     @Scripts.Render("~/bundles/jqueryui")
    @Scripts.Render("~/bundles/cascade")
    <script type="text/javascript">
        function GetMsg(data)
        {
            alert(data.Msg);
            if (data.IsSuccess)
            {
                window.location.href = '@Url.Action("Index")';
            }
        }

        $(function ()
        {
            $("#CreateUsersID").cascade({
                source: '@Url.Action("GetAccount", "Account")',
                cascaded: 'UsersID',
                disableUntilLoaded: true
            });
        }); 
    </script>
}